#ifndef TDDDIALOG_H
#define TDDDIALOG_H

#include <atlbase.h>
#include <atlwin.h>
#include <atldlgs.h>

#include "WinStatic.h"
#include "Buttons.h"
#include "TestsTreeView.h"
#include "ProgressBar.h"

namespace TddGui
{

class CTddGuiDialog: public CDialogImpl<CTddGuiDialog>
{
	WinStatic m_error;
	WinStatic m_st;
	RunButton m_run;
	TestsTreeView m_tv;
	LoadButton m_load;
	ProgressBar m_pb;

public:
	enum { IDD = IDD_TDD_GUI };

	CTddGuiDialog()
		: m_run(m_tv)
		, m_tv(m_st, m_error, m_run, m_pb)
		, m_load(m_tv)
	{}

	BEGIN_MSG_MAP(CTddGuiDialog)
		MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
		COMMAND_ID_HANDLER(IDCANCEL, OnCloseCmd)
		REFLECT_NOTIFICATIONS()
	END_MSG_MAP()

	LRESULT OnInitDialog (UINT , WPARAM , LPARAM , BOOL& bHandled)
	{
		m_error.Init(GetDlgItem(IDC_ERROR_OUTPUT));
		m_load.Init(GetDlgItem(IDC_BUTTON_LOAD));
		m_run.Init(GetDlgItem(IDC_BUTTON_RUN));
		m_run.EnableWindow(FALSE);
		m_tv.Init(GetDlgItem(IDC_TREE_TESTS));
		m_st.Init(GetDlgItem(IDC_DLL_NAME));
		m_pb.Init(GetDlgItem(IDC_PROGRESS_BAR));

		CenterWindow(GetParent());

		return bHandled = TRUE;
	}
	LRESULT OnCloseCmd(WORD, WORD, HWND, BOOL&)
	{
		EndDialog(-1);
		return 0;
	}
};

}

#endif